Lowranceusr4: don't try to compute date on invalid input.
authorrobertlipe <robertlipe@gmail.com>
Sat, 8 Dec 2012 07:52:13 +0000 (07:52 +0000)
committerrobertlipe <robertlipe@gmail.com>
Sat, 8 Dec 2012 07:52:13 +0000 (07:52 +0000)
gpsbabel/lowranceusr4.c

index f83164ccc323a20c8e184cc88b922ab38c9a0df3..7c00c01fec359eb687f3605f8f216e8fbd3f1778 100644 (file)
@@ -437,7 +437,14 @@ lowranceusr4_parse_waypoints(void)
        time is a unix timestamp. */
     create_date = gbfgetint32(file_in);
     create_time = gbfgetint32(file_in);
-    wpt_tmp->creation_time = lowranceusr4_get_timestamp(create_date, create_time);
+
+    // Julian date 2440487 is 1/1/1970.  If that's the date we're working
+    // with, as a practical matter, we have no date, so don't even compute
+    // or set it.
+    if (create_date > 2440587) {
+      wpt_tmp->creation_time = lowranceusr4_get_timestamp(create_date,
+                                                          create_time);
+    }
 
     /* Unused byte */
     gbfgetc(file_in);